<?php

namespace app\admin\validate;

use think\Validate;
use app\common\Error;

class WechatTarget extends Validate
{
    protected $rule = [
        'video_id' => 'require',
        'id' => 'require',
        'product_name' => 'require',
        'image_url' => 'require',
        'author' => 'require',
        'video_url' => 'require',
        'applet_id' => 'require',
        'expiration_time' => 'require',
        'category_id'=>'require',
        'adv_id'=>'require',
        'catalog_name'=>'require'
    ];

    protected $message = [
        'video_id.require' => Error::VIDEO_ID_NOT_EXIXTS,
        'id.require' => Error::ID_NOT_EXIXTS,
        'product_name.require' => Error::NAME_NOT_EXIXTS,
        'image_url.require' => Error::IMAGE_URL_NOT_EXIXTS,
        'video_url.require' => Error::VIDEO_URL_NOT_EXIXTS,
        'author.require' => Error::AUTHOR_NOT_EXIXTS,
        'applet_id.require' => Error::APPLET_ID_NOT_EXIXTS,
        'expiration_time.require' => Error::EXPIRATION_TIME_NOT_EXIXTS,
        'category_id.require' => Error::CATEGORY_ID_NOT_EXIXTS,
        'adv_id.require' => Error::ADV_ID_NOT_EXIXTS,
        'catalog_name.require' => Error::CATALOG_NAME_NOT_EXIXTS,
    ];

    protected $scene = [
        'list' => ['video_id'],
        'add' => [ 'video_id', 'product_name', 'author', 'image_url','video_url','applet_id','expiration_time','category_id'],
        'edit' => ['id',  'video_id', 'product_name', 'author', 'image_url','video_url','applet_id','expiration_time','category_id'],
        'delete' => ['id'],
        'detail' => ['id'],
        'catalog_add'=>['adv_id','catalog_name'],
        'catatlog_edit'=>['id','adv_id','catalog_name']
    ];
}